<template>
<div>新闻列表
    <ul>
        <li v-for="item in state.list" :key="item.id">
          <div>{{ item.name }}  <span @click="edit(item.id,item.name)">修改</span></div>
        </li>
    </ul>
</div>
</template>
<script setup lang='ts'> 
 import {ref,reactive} from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter();
 const state = reactive({
  list: [
    {
        id:1,
      name: '新闻1',
      time: '2021-01-01',
      content: '新闻内容1'
    },
    {
        id:2,
      name: '新闻2',
      time: '2021-01-02',
      content: '新闻内容2'
    },
    {
        id:3,
      name: '新闻3',
    }
  ]
 })

 const edit = (id,name) => {
    router.push(`/manage/news/edit/${id}/${name}`);
 }
</script>
<style scoped lang='less'>
</style>